﻿module CreateDll
#light
open System
open System.Diagnostics
open System.IO
open System.Threading

let build_dll = 
  try
    let file_path = Directory.GetCurrentDirectory().Replace(" ","%20")
    let args = "file.fs" +
               " --noframework" +
               " --optimize" +
               " -r:\"C:\\Program Files\\Reference Assemblies\\Microsoft\\FSharp\\2.0\\Runtime\\v4.0\\FSharp.Core.dll\"" +
               " -r:\"C:\\Program Files\\Microsoft XNA\\XNA Game Studio\\v4.0\\References\\Windows\\x86\\Microsoft.Xna.Framework.dll\"" +
               " -r:\"C:\\Program Files\\Microsoft XNA\\XNA Game Studio\\v4.0\\References\\Windows\\x86\\Microsoft.Xna.Framework.Game.dll\"" +
               " -r:\"C:\\Program Files\\Microsoft XNA\\XNA Game Studio\\v4.0\\References\\Windows\\x86\\Microsoft.Xna.Framework.Graphics.dll\"" +
               " -r:\"C:\\Program Files\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\mscorlib.dll\"" + 
               " -r:\"C:\\Program Files\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Core.dll\"" +
               " -r:\"C:\\Program Files\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.dll\"" +
               " -r:\"C:\\Program Files\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Numerics.dll\"" +
               " -r X3DCodeQuotation.dll" +
               //@" -r Microsoft.Xna.Framework.Game.dll" +
               @" -o file.dll" +
               @" -a"

   
    do Console.WriteLine args
    let pi = new ProcessStartInfo("C:\\Program Files\\Microsoft F#\\v4.0\\Fsc.exe",args)
    do pi.UseShellExecute <- false
    Process.Start(pi).WaitForExit()
  with
    ex -> System.Console.WriteLine ex